package com.freeland.client2009.webservices;

import static org.junit.Assert.*;

import javax.annotation.Resource;

import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;

@ContextConfiguration(locations={"classpath:TestapplicationContext.xml"})
public class testGameServiceByClient extends AbstractJUnit4SpringContextTests {
	
	@Resource(name="gameServiceTest")
	public GameService gameServiceTest;
	
	@Test
	public void testGetGameInfoList(){
		String sRet = gameServiceTest.getGameInfoList("1000");
		System.out.println(sRet);
		assertTrue(!sRet.equals(""));
	}
	@Test
	public void testGetPushedGameInfoList(){
		
		String sRet = gameServiceTest.getPushedGameInfoList("1000","330100","30001984000");
		System.out.println(sRet);
		assertTrue(!sRet.equals(""));
	}
	@Test
	public void testGetPushedGameInfoListByAreaId(){
		String sRet = gameServiceTest.getPushedGameInfoList("1000","1","");
		System.out.println(sRet);
		assertTrue(!sRet.equals(""));
	}
	@Test
	public void testGetPushedGameInfoListByNetBarId(){
		String sRet = gameServiceTest.getPushedGameInfoList("1000","","30001984000");
		System.out.println(sRet);
		assertTrue(!sRet.equals(""));
	}
	@Test
	public void testGetPushedGameInfoListByNull(){
		String sRet = gameServiceTest.getPushedGameInfoList("1000","","");
		System.out.println(sRet);
		assertTrue(sRet.equals("-2"));
	}
	@Test
	public void testGetDeletedGameInfoList(){
		String sRet = gameServiceTest.getDeletedGameInfoList("1000","330100","30001984000");
		System.out.println(sRet);
		assertTrue(!sRet.equals(""));
	}
	@Test
	public void testGetDeletedGameInfoListByNull(){
		String sRet = gameServiceTest.getDeletedGameInfoList("1000","","");
		System.out.println(sRet);
		assertTrue(sRet.equals("-2"));
	}
	@Test
	public void testSetGameInfoPropertyByErrorGameid(){
		int sRet = gameServiceTest.setGameInfoProperty("1000", "asdrasdfas");
		System.out.println(sRet);
		assertEquals(-2, sRet);
	}
	
	@Test
	public void testSetGameInfoPropertyByErrorCID(){
		int sRet = gameServiceTest.setGameInfoProperty("100000", "100024,100026");
		System.out.println(sRet);
		assertEquals(-1, sRet);
	}
	
	@Test
	public void testSetGameInfoProperty(){
		int sRet = gameServiceTest.setGameInfoProperty("1000", "100024,100026");
		System.out.println(sRet);
		assertEquals(0, sRet);
	}
	
}
